proc msg:cycle {nick host handle arg} {
  global botnick
  set argument [lindex $arg 0]

  # if channel is in argument
  if {[string match "#*" $argument]} {
    # if channel is valid
    if {[validchan $argument]} {
      set chan $argument
      set botnet [lrange $arg 1 end]
    } else {
      putquick "NOTICE $nick :\0034ERROR - This bot is not in $argument."
      return 0
    }
  } else {
    putquick "NOTICE $nick :\0034ERROR - You need to specify a channel."
    return 0
  }

  # if user is not a global op or is not a channel owner...
  if {![matchattr $handle o|n $chan]} {
    putquick "NOTICE $nick :\0034ERROR - Permission Denied."
    return 0
  }

  if {![matchattr $handle A]} {
    putquick "NOTICE $nick :\0034ERROR - You need to authenticate first."
    putquick "NOTICE $nick :\00312You may authenticate yourself by typing \0033\002/msg $botnick auth <your password>\002"
    return 0
  }

  if {[matchattr $handle D]} {
    putquick "NOTICE $nick :\0034ERROR - Permission Denied - Access Is Disabled."
    return 0
  }

  cycle $nick $host $handle $chan
  return 0
}








